package com.android.shop.ui;

import java.util.LinkedList;
import java.util.List;

import android.app.Activity;
import android.content.SharedPreferences;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.shop.R;
import com.android.shop.adapter.OrderActivityAdapter;
import com.android.shop.api.MyHttpClient;
import com.android.shop.bean.Order;
import com.android.shop.constant.MyConstantID;
import com.pulltorefresh.library.PullToRefreshBase;
import com.pulltorefresh.library.PullToRefreshBase.Mode;
import com.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2;
import com.pulltorefresh.library.PullToRefreshListView;


public class OrderListActivity extends BaseActivity {

	public enum ORDERTYPE{
		diancan,waimai
	}
	public enum STATE{
		WAIT_HANDLE,HANDLED
	}
	//重要参数
	private String state=STATE.WAIT_HANDLE.toString();				//当前的状态;待处理，已处理
	private String orderType=ORDERTYPE.waimai.toString();			//当前订单状态
	private String operate="first";								    //当前操作
	private String waimai_id="0",diancan_id="0";					//id

	private PullToRefreshListView listView_waimai;
	private PullToRefreshListView listView_diancan;
	private TextView state_wait, state_processed;
	// 数据存储
	private List<Order> list_order;
	private OrderActivityAdapter orderAdapter;
	
	private LinkedList<String> mListItems;
	private PullToRefreshListView mPullRefreshListView;
	private ArrayAdapter<String> mAdapter;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.order_list_tab);
	}
	
	/**
	 * 需要获取数据的操作："待处理"、"未处理"、"点餐"、"外卖"、"up"、"down"、"first"
	 */
	public void GetDate() {
		String _ordertype=orderType;
		String _state=state;
		String _operate=operate;
		String _id="0";
		if(orderType.equals(ORDERTYPE.diancan.toString())){
			_id=diancan_id;
		}else if(orderType.equals(ORDERTYPE.waimai.toString())){
			_id=waimai_id;
		}
		SharedPreferences sp = getSharedPreferences(MyConstantID.SP_NAME,Activity.MODE_PRIVATE);
		String sellerid = sp.getString("sellerid", "");// 获取商户id
		String userType="seller";
		list_order= MyHttpClient.getSingle().getOrderList(sellerid, userType, _ordertype, _state, _operate, _id);
	}
}
